<template>
	<view class="detailed">
		<navL :navlist="navlist" @chooseNav="chooseNav"></navL>
		<view class="detail_list" v-if="isShow">
			<view class="list_item" v-for="(item,index) in list" :key="item.id">
				<view class="list_item_box">
					<view class="left">
						<view class="title">订单 ：{{item.order_num}}</view>
						<view class="num"><text>金额</text><text class="tips">{{item.num}}</text></view>
						<view class="num" v-if="type == 'withdraw'"><text>到账</text><text
								class="tips">{{item.real_num}}</text></view>
						<view class="num" v-if="type == 'withdraw'"><text>提现至</text><text
								class="tips">{{item.bank_name}}</text></view>
						<view class="num"><text>状态</text><text class="tips">{{config[item.status]}}</text></view>
						<view class="num"><text>时间</text><text class="tips">{{item.add_time|ShortTime}}</text></view>
					</view>

				</view>
			</view>
		</view>
		<view class="noMore" v-if="!isShow">
			------- 没有更多了 -------
		</view>
	</view>
</template>

<script>
	import {
		Record
	} from "@/api/api.js"
	import navL from "@/components/nav/nav.vue"
	export default {
		components: {
			navL
		},
		data() {
			return {
				isShow: false,
				navlist: ['充值明细', '提现明细'],
				config: {},
				type: 'recharge',
				list: []
			}
		},
		onLoad(e) {
			uni.setNavigationBarTitle({
				title: e.title
			})
			if (this.type == 'recharge') {
				this.config = {
					0: '待充值',
					1: '已完成'
				}
			} else {
				this.config = {
					0: '待审核',
					1: '已到账',
					2: '已驳回'
				}
			}
			this.Record()
		},
		methods: {
			chooseNav(e) {
				this.list = []
				if (e == 0) {
					this.type = 'recharge'
				} else if (e == 1) {
					this.type = 'withdraw'
				}
				if (this.type == 'recharge') {
					this.config = {
						0: '待充值',
						1: '已完成'
					}
				} else {
					this.config = {
						0: '待审核',
						1: '已到账',
						2: '已驳回'
					}
				}
				this.Record()
			},
			Record() {
				Record({
					type: this.type
				}).then(res => {
					this.list = res.data
					if (res.data.length > 0) {
						this.isShow = true
					} else {
						this.isShow = false
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #0F172A;
	}


	.noMore {
		padding-top: 30px;
		text-align: center;
		color: #fff;
	}

	.list_item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px;
		background-color: #1E293B;
		width: 96%;
		margin: 0 auto;
		margin-top: 10px;
		box-sizing: border-box;
		border-radius: 8px;
		color: #fff;

		.list_item_box {
			width: 100%;
		}

		.left {
			display: flex;
			flex-direction: column;
			font-size: 14px;

			.title {
				color: #7989D5;
				font-weight: bold;
				font-size: 15px;
			}

			.time {
				font-weight: bold;
				font-size: 12px;
				margin-top: 8px;
			}
		}

		.num {
			font-size: 14px;
			margin-top: 5px;
			display: flex;
			justify-content: space-between;
		}

		.tips {
			font-weight: bold;
		}
	}
</style>